package com.itheima.test2;

import java.util.ArrayList;
import java.util.HashSet;

public class Test {
    public static void main(String[] args) {
        ArrayList<String> list = new ArrayList<>();
        // "a","f","b","c","a","d"
        list.add("a");
        list.add("f");
        list.add("b");
        list.add("c");
        list.add("a");
        list.add("d");
        System.out.println(list);

//        HashSet<String> set = new HashSet<>();
//        for (String s : list) {
//            set.add(s);
//        }
//        list.clear();
//        for (String s : set) {
//            list.add(s);
//        }
//        System.out.println(list);

        HashSet<String> set2 = new HashSet<>(list);
        list = new ArrayList<>(set2);
        System.out.println(list);
    }
}
